<?php
/*
	提现
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
cfc('core')->checklogin();
if($_RQ['op']=='get'){
	$pid=intval($_RQ['pid']);
	if(!$pid){
		exi('请选择账本！','erroe');
	}
	$member=pdo_get('core_members',array('id'=>$_SESSION['uid']));
	$item=pdo_get('jy_jifee_list',array('id'=>$pid,'uniacid'=>$_SESSION['uniacid']));
	if($item['mid']!=$_SESSION['uid']){
		$this->model('model')->check_look($pid);
	}
	$data=array();
	$data['chufee']=pdo_getsum('jy_jifee_chu',array('pid'=>$item['pid'],'uniacid'=>$_SESSION['uniacid']),'fee');
	$data['addfee']=pdo_getsum('jy_jifee_add',array('pid'=>$item['pid'],'uniacid'=>$_SESSION['uniacid']),'fee');
	$return['data']=$data;
	$return['item']=$item;
	$return['member']=$member;
	$return['params']=array('type'=>0,'pid'=>$pid);
	$return['sharedata']=array(
		'title'=>$item['title'],
		'desc'=>$item['desc'],
		'link'=>custom_url('jy_jifee/item//id='.$pid.'&fromuser='.$_SESSION['uid'],true),
		'imgUrl'=>$return['pluginset']['share_image']?tomedia($return['pluginset']['share_image']):tomedia($return['pluginset']['icon'])
	);
	set_html('title',$item['title']);
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'pid'=>$_RQ['pid']);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$return['list']=pdo_getslice('jy_jifee_month',$params,array($pindex,$psize),$total,array(),'','monthtime desc');
	foreach($return['list'] as $k=>&$item){
		$item['member']=cfc('core')->member_show($item['mid']);
		$item['chufee']=pdo_getsum('jy_jifee_chu',array('pid'=>$item['pid'],'days like'=>'%'.$item['months'].'%','uniacid'=>$_SESSION['uniacid']),'fee');
		$item['addfee']=pdo_getsum('jy_jifee_add',array('pid'=>$item['pid'],'days like'=>'%'.$item['months'].'%','uniacid'=>$_SESSION['uniacid']),'fee');
	}
	exi($return);
}